﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Box_games
{
    class DBHelpe
    {
        static string str = "server=.;database=DB;Integrated Security=true";
        static SqlConnection coon = new SqlConnection(str);
        public static DataTable Select(string sql)
        {
            SqlDataAdapter sda = new SqlDataAdapter(sql, coon);
            DataSet ds = new DataSet();
            sda.Fill(ds);
            return ds.Tables[0];
        }

        //上传分数至数据库
        public static void ADD(string sql) 
        {
            coon.Open();
            SqlCommand comm = new SqlCommand(sql, coon);
            int num = comm.ExecuteNonQuery();
            coon.Close();
            
        }
    }
}
